/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package database;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import model.Supplyer;

/**
 *
 * @author elfatah 
 */
public class DBSupplier extends DBClass{
     public List getSupplierDetails() throws SQLException, ClassNotFoundException {

        Connection con = createConnection();
        PreparedStatement pstmt = con.prepareStatement("select * from supplyer");
        ResultSet rs = pstmt.executeQuery();
        List list = new ArrayList();
        while (rs.next()) {
            Supplyer ubean = new Supplyer();
            ubean.setSupplyerId(Integer.parseInt(rs.getString(1)));
            ubean.setNama(rs.getString(2));

            list.add(ubean);

        }
        return list;
    }

}
